package com.yami.shop.platform.controller;

import cn.hutool.json.JSONObject;

import com.yami.shop.bean.model.TbVersion;
import com.yami.shop.common.bean.PageDTO;
import com.yami.shop.common.bean.PageVO;
import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.service.VersionService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/version/")
public class VersionController {

    @Autowired
    private VersionService versionService;

    @GetMapping("getList")
    @Operation(summary = "获取VersionList")
    public ServerResponseEntity<PageVO<TbVersion>> getList(@Valid PageDTO pageDTO){
        return ServerResponseEntity.success(versionService.getList(pageDTO));
    }

    @PostMapping("saveVersion")
    @Operation(summary = "保存Version")
    public ServerResponseEntity<Void> saveVersion(@RequestBody TbVersion tbVersion){
        versionService.saveVersion(tbVersion);
        return ServerResponseEntity.success();
    }
}
